/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include <string>
#include <stack>

int main() {
    std::string a;
    std::getline(std::cin, a);
    std::stack<char> b;
    for (char i : a) {
        if (i == '(' || i == '[' || i == '{' || i == '<') {
            b.push(i);
        }
        if (i == ')' || i == ']' || i == '}' || i == '>') {
            if (!b.empty()) {
                char top = b.top();
                if ((top == '(' && i == ')') || (top == '[' && i == ']') || (top == '{' && i == '}') || (top == '<' && i == '>')) {
                    b.pop();
                } else {
                    break;
                }
            } else {
                b.push(i);
                break;
            }
        }
    }
    if (!b.empty()) {
        std::cout << "False" << std::endl;
    } else {
        std::cout << "True" << std::endl;
    }
    return 0;
}


